<%@ page import="java.util.List" %>
<%@ page import="com.ooho.lesson05.mvc.model.SiteBean" %><%--
  Created by IntelliJ IDEA.
  User: hugohoo
  Date: 10/11/16
  Time: 3:16 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Show all sites</title>

    <link rel="stylesheet" href="/public/css/materialize.min.css">

    <script src="/public/js/jquery-3.1.0.min.js"></script>
    <script src="/public/js/materialize.min.js"></script>
</head>
<body>
    <div class="container">
        <h4>All Sites:</h4>
        <table class="striped centered">
            <thead>
            <tr>
                <th>id</th>
                <th>title</th>
                <th>url</th>
                <th>Operate</th>
            </tr>
            </thead>
            <tbody>
            <%
                for (SiteBean sb : (List<SiteBean>)request.getAttribute("siteList")){
            %>
            <tr>
                <td> <%= sb.getId()%> </td>
                <td> <%= sb.getTitle()%> </td>
                <td> <%= sb.getUrl()%> </td>
                <td>
                    <a class="btn waves-effect blue waves-light" href="./edit?id=<%= sb.getId()%>">edit</a> &nbsp;
                    <a class="btn waves-effect red waves-light" href="./delete_do?id=<%= sb.getId()%>">delete</a>
                </td>
            </tr>
            <%
                }
            %>
            </tbody>
        </table>
        <br/>
        <a href="./add.jsp" class="btn green waves-effect waves-light">add</a>
    </div>
</body>
</html>
